<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/font-awesome.min.css">

	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/doc.min.css">
	<style>
	.tree li{
        list-style-type: none;
		cursor:pointer;
	}
	</style>
</head>
<body>
      <div class="col-sm-12 col-sm-offset-0 col-md-12 col-md-offset-0 main">
		<ol class="breadcrumb">
		  <li><a href="#">首页</a></li>
		  <li><a href="#">登记房屋</a></li>
		  <li><a href="${pageContext.request.contextPath}/houseRegister/getHouses.jsp">楼盘信息</a></li>
		  <li class="active">新增房屋信息</li>
		</ol>
		<div class="panel panel-default">
	      <div class="panel-heading">表单数据<div style="float:right;cursor:pointer;" data-toggle="modal" data-target="#myModal"><i class="glyphicon glyphicon-question-sign"></i></div></div>
		  	<div class="panel-body">
				<form role="form" id="formHouse">
				  <div class="form-group" style="padding: 20px;">
					<label for="exampleInputPassword1" class="col-sm-2 control-label" style="text-align: center;">房屋编号：</label>
					<div class="col-sm-4">
					<input type="text" class="form-control" name="house_id" placeholder="请输入房屋编号（栋别-房号）" required>
				  	</div>
					<label for="exampleInputPassword1" class="col-sm-2 control-label" style="text-align: center;">房屋面积：</label>
					<div class="col-sm-4">
						<input type="text" class="form-control" name="house_area" placeholder="请输入房屋面积" required>
				  	</div>
				  </div>
				  <div class="form-group" style="padding: 20px;">
					<label for="exampleInputEmail1" class="col-sm-2 control-label" style="text-align: center;">房屋户型：</label>
					<div class="col-sm-4">
					<input type="text" class="form-control" name="house_shape" placeholder="请输入房屋户型" required>
				  	</div>
					<label for="exampleInputEmail1" class="col-sm-2 control-label" style="text-align: center;">房屋楼层：</label>
					<div class="col-sm-4">
					<input type="text" class="form-control" name="house_floor" placeholder="请输入房屋楼层" required>
				  	</div>
				  </div>
				  <div class="form-group" style="padding: 20px;">
					<label for="exampleInputEmail1" class="col-sm-2 control-label" style="text-align: center;">房屋结构：</label>
					<div class="col-sm-4">
					<input type="text" class="form-control" name="house_structure" placeholder="请输入房屋结构" required>
				  	</div>
				  	<label for="exampleInputEmail1" class="col-sm-2 control-label" style="text-align: center;">房屋产别：</label>
					<div class="col-sm-4">
					<input type="text" class="form-control" name="house_assets" placeholder="请输入房屋产别" required>
				  	</div>
				  </div>
				  <div class="form-group" style="padding: 20px;">
					<label for="exampleInputEmail1" class="col-sm-2 control-label" style="text-align: center;">房屋年代：</label>
					<div class="col-sm-4">
					<input type="text" class="form-control" name="house_time" placeholder="请输入房屋年代（年）" required>
				  	</div>
				  </div>
				  <div style="height:60px;width:300px;float:right;padding: 20px;">
					  <button type="button" class="btn btn-success" id="add"><i class="glyphicon glyphicon-plus"></i>添加</button>
					  <button type="reset" class="btn btn-danger"><i class="glyphicon glyphicon-refresh"></i>重置</button>
					  <a href="${pageContext.request.contextPath}/houses/skipInterface"><button type="button" class="btn btn-success"><i class="glyphicon glyphicon-plus"></i>返回</button></a>
					</div>
				</form>
		 	</div>
		</div>
      </div>
    <script src="${pageContext.request.contextPath}/jquery/jquery-2.1.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/bootstrap/js/bootstrap.min.js"></script>
	<script src="${pageContext.request.contextPath}/script/docs.min.js"></script>
	<script type="text/javascript"  src="${pageContext.request.contextPath}/js/jquery-1.12.3.min.js"></script>
    <script type="text/javascript">
        $(function () {
        	addHouse();
        });
        function addHouse(){
       	 $("#add").click(function(){
       		$.ajax({
       			url:"${pageContext.request.contextPath}/house/addHouse",
       			type:"post",
       			async:true,
       			data:$("#formHouse").serialize(),
       			error:function(){
       				
       			},
       			success:function(data){
       				alert(data);
       				document.getElementById("formHouse").reset();
       			}
       		});
       	 });
        }
    </script>
</body>
</html>